package com.gitee.center.runtime.def;

import com.gitee.center.runtime.IRegistryAware;
import com.gitee.center.runtime.InternalIndexer;
import com.gitee.center.runtime.annotation.Domain;
import com.gitee.center.runtime.tool.InternalAopUtils;
import lombok.Getter;

@Getter
public class DomainDef implements IRegistryAware {
    private String code;
    private String name;
    private Object domainBean;
    @Override
    public void registerBean(Object bean) {
        Domain domain = InternalAopUtils.getAnnotation(bean, Domain.class);
        this.code = domain.code();
        this.name = domain.name();
        this.domainBean = bean;

        InternalIndexer.index(this);
    }
}
